import router from '../router/index'

import axios from './axios';
const domain='http://nyh5api.dindong.cn/api/';
axios.defaults.baseURL=domain;
axios.interceptors.response.use(function (response) { 
  // 重定向到登录页面 
  if (response.data.data == 'no_login'){
    window.localStorage.removeItem('user_name');
    window.location.href = domain + "auth/wechatLogin";
  }else{


    return response;
  }
})
    //获取活动详情
    export const getActivityList = (params) => axios.get('active/getPhotoList',{'params':{...params}});
    export const getRank = (params) => axios.get('active/getRank',{'params':{...params}});
    export const setVotes = (params) => axios.post('active/setVote',params);
    //报名
    // export const activitySignUp = (params) => axios.post('activity/activitySignUp',params);
    //上传头像(文件上传)
  //   export const uploadImg = (params) => axios.post('file/upload-img',params,{headers:{'Content-Type':'multipart/form-data'}});
  //   //获取答卷列表
  //   export const getAnswerSheetList = (params) => axios.get('answer/getAnswerSheetList',{'params':{...params}});
  //   //获取题目列表
  //   export const getQuestionsList = (params) => axios.get('answer/getQuestionsList',{'params':{...params}});
  //   //逐题保存题目
  //   export const answerAction = (params) => axios.post('answer/answerAction',params);
  //   //保存题目
  //   export const submitAnswer = (params) => axios.post('answer/submitAnswer',params);
  //
  // // 排行榜
  //   //获取答卷详情
  //   export const getUserQuestionAnswer = (params) => axios.get('admin/sys/getUserQuestionAnswer', {'params':{...params}});
  //   //获取排行榜列表
  //   export const getLeaderBoard = (params) => axios.get('answer/getLeaderBoard', {'params':{...params}});
    
    
    
    
    
    
    

    